package tech.aistar.mapper.noteinfo;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;


/**
 * Created by lenovo on 2019/10/10.
 */
public interface INotePayMapper {

    /**
     * 散列的订单数据 - 保存到数据库中
     * @param userId
     * @param orderNum
     * @param payNum
     * @param money
     * @param orderTime
     * @param noteId
     * @param noteName
     */
    @Select("insert into note_order(user_id,orderNum,payNum,money,order_time,note_id,note_name) values (#{userId},#{orderNum},#{payNum},#{money},#{orderTime},#{noteId},#{noteName})" )//order_time,
    void updateOrderStatus(@Param("userId") Integer userId, @Param("orderNum") String orderNum, @Param("payNum") String payNum, @Param("money") Double money, @Param("orderTime") String orderTime, @Param("noteId") Integer noteId, @Param("noteName") String noteName);

    /**
     * 根据用户Id和文章Id
     * 查询用户对应的订单编号是否下单
     * @param userId
     * @param noteId
     * @return
     */
    @Select("select id from note_order where user_id = #{userId} and note_id=#{noteId}")
    Integer findOrderIdById(@Param("userId") Integer userId,@Param("noteId") Integer noteId);
}
